import { createRouter, createWebHashHistory } from 'vue-router';
import { onMounted } from 'vue';
import Layout from '@/views/Layout/Layout.vue';

import AboutView from '@/views/About/AboutView.vue';
import Login from '@/views/Login/Login.vue';
import Register from '@/views/Register/Register.vue';
import TeacherView from '@/views/Teacher/AIClassroom.vue';
import teacher from '@/views/Teacher/TeacherHome.vue';
import preview from '@/views/Teacher/preview.vue';
import homework from '@/views/Teacher/homework.vue';
import question from '@/views/Teacher/question.vue';
export const router = createRouter({
  history: createWebHashHistory(), // 使用默认的历史管理器
  // 路由滚动行为定制
  scrollBehavior() {
    return {
      top: 0
    }
  },
  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/',
          component: Login
        },
        {
          path: '/teacher',
          component: teacher
        },
        {
          path: '/aiclass',
          component: TeacherView
        },
        {
          path: '/preview',
          component: preview
        },
        {
          path: '/homework',
          component: homework
        },
        {
          path: '/question',
          component: question
        },
        {
          path: '/know_graph',
          component: () => import('@/views/Teacher/knowledge_graph/knowledge_graph.vue')
        },
        {
          path: '/mine',
          component: () => import('@/views/Teacher/TeacherMine.vue')
        },
        {
          path: '/N11',
          component: () => import('@/views/Teacher/analysis.vue')
        },
        {
          path: '/my_class',
          component: () => import('@/views/Teacher/MyClass.vue')
        },
        {
          path: '/analysis2',
          component: () => import('@/views/Teacher/analysis2.vue')
        },
        {
          path: '/new_homework',
          component: () => import('@/views/Teacher/New_Homework.vue')
        }
      ]
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/Register',
      component: Register
    },
    {
      path: '/about',
      component: AboutView
    },
    {
      path: '/draw_graph',
      component: () => import('@/views/Teacher/knowledge_graph/draw_graph.vue')
    }
  ],
});

onMounted(() => {
  // 如果有需要，可以在挂载后做一些初始化操作
});

export default router

